<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/jquery-3.5.1.min.js"></script>
</head>
<body>
<form id="frm_evaluate">
    <table border="1">
        <tr>
            <th>等级:</th>
            <th><input type="text" name="evaluateLevel"></th>
        </tr>
        <tr>
            <th>用户ID:</th>
            <th><input type="text" name="userId"></th>
        </tr>
        <tr>
            <th>购物记录ID:</th>
            <th><input type="text" name="recordId"></th>
        </tr>
        <tr>
            <th>留言:</th>
            <th>
                <textarea name="evaluateComm" id="introduce" cols="30" rows="10" placeholder="请留下您宝贵的建议"></textarea>
            </th>
        </tr>
    </table>
    <input type="button" value="提交" id="btn_submit">
</form>
<script>
    $("#btn_submit").click(function () {
        $.ajax(
            {
                url: "http://localhost:8080/evaluate/save",
                type: "post",
                dataType: "json",
                data: $("#frm_evaluate").serialize(),
                success: function (data) {
                    if (data.result = 1) {
                        alert("评价成功");
                    } else {
                        alert("评价失败");
                    }
                }
            }
        )
    })
</script>
</body>
</html>